import service from "@/utils/service";

// 登录
export const loginApi = (data: any) => {
  return service({
    url: "/pc/user/auth/login",
    method: "post",
    data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    }
  });
};

// 上传文件
export const uploadFileApi = (data: any) => {
  return service({
    url: "/xiechetong/sysFile/media/upload",
    method: "post",
    data,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  });
};

// ocr识别
export const ocrIdentifyApi = (data: any) => {
  return service({
    url: "/xiechetong/system/ocr-driving",
    method: "get",
    params: data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    }
  });
};

// 获取用户菜单
export const getUserMenuListApi = () => {
  return service({
    url: "/xiechetong/sysUsers/get-menu-permission-list",
    method: "get",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    }
  });
};

// 菜单列表
export const getMenuListApi = (data: any) => {
  return service({
    url: "/xiechetong/sysMenu/get-all-menu",
    method: "post",
    data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    }
  });
};

// 修改密码
export const changePasswordApi = (data: any) => {
  return service({
    url: "/pc/user/auth/modify-password",
    method: "post",
    data
  });
};

// 新增菜单
export const addMenuApi = (data: any) => {
  return service({
    url: "/xiechetong/sysMenu/add",
    method: "put",
    data
  });
};

// 修改菜单
export const editMenuApi = (data: any) => {
  return service({
    url: "/xiechetong/sysMenu/update",
    method: "post",
    data
  });
};

// 删除菜单
export const deleteMenuApi = (data: any) => {
  return service({
    url: "/xiechetong/sysMenu/del/" + data,
    method: "delete"
  });
};

// 获取角色-分页
export const getRoleListApi = (data: any) => {
  return service({
    url: "/xiechetong/xctRole/page",
    method: "post",
    data
  });
};

// 获取角色-所有
export const getRoleAllListApi = (data?: any) => {
  return service({
    url: "/xiechetong/xctRole/list",
    method: "post",
    data
  });
};

// 新增角色
export const addRoleApi = (data: any) => {
  return service({
    url: "/xiechetong/xctRole/add",
    method: "put",
    data
  });
};

// 修改角色
export const editRoleApi = (data: any) => {
  return service({
    url: "/xiechetong/xctRole/update",
    method: "post",
    data
  });
};

// 删除角色
export const deleteRoleApi = (data: any) => {
  return service({
    url: "/xiechetong/xctRole/del/" + data,
    method: "delete",
  });
};

// 获取当前角色的菜单id
export const getCurrentRoleMenuListApi = (params: any) => {
  return service({
    url: "/xiechetong/xctRole/permission-query",
    method: "get",
    params,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    }
  });
};

// 设置当前角色的菜单
export const setCurrentRoleMenuListApi = (data: any) => {
  return service({
    url: "/xiechetong/xctRole/configuring-permission",
    method: "post",
    data
  });
};

// 获取用户列表
export const getUserListApi = (data: any) => {
  return service({
    url: "/xiechetong/sysUsers/page",
    method: "post",
    data
  });
};
// 新增用户
export const addUserApi = (data: any) => {
  return service({
    url: "/xiechetong/sysUsers/add",
    method: "put",
    data
  });
};

// 更新用户信息
export const updateUserApi = (data: any) => {
  return service({
    url: "/xiechetong/sysUsers/update",
    method: "post",
    data
  });
};

// 获取车辆列表-不分页
export const getCustomerCarListApi = () => {
  return service({
    url: "/xiechetong/xctRepairShopCustomersCar/list",
    method: "post"
  });
};
// 获取车辆列表-分页
export const getCustomerCarPageApi = (data: any) => {
  return service({
    url: "/xiechetong/xctRepairShopCustomersCar/page",
    method: "post",
    data
  });
};

// 获取区县-不分页
export const getAreaListApi = () => {
  return service({
    url: "/xiechetong/xctArea/list",
    method: "post"
  });
};

// 新企业备案
export const insert = (data: any) => {
  return service({
    url: "/xiechetong/xctRepairCompany/insert ",
    method: "post",
    data
  });
};